package net.godcode.olivenotes.entities;


import org.hibernate.Query;
import org.hibernate.Session;

/**
 * RoleDAOHibernate
 * 
 * @author Chris Lewis Jan 2, 2008 <chris@thegodcode.net>
 * @version $Id: RoleDAOHibernate.java 12 2008-01-05 14:22:07Z burningodzilla $
 */
public class RoleDAOHibernate extends GenericHibernateDAO<Role, Long> implements RoleDAO {
	
	public RoleDAOHibernate(Session session) {
		super();
		setSession(session);
	}
	
	public Role findByName(String name) {
		Query q = getSession().createQuery("from Role where name=:name"); //TODO named query
		q.setParameter("name", name);
		return (Role)q.uniqueResult();
	}

}
